zynqmp: pm: Reverse logic for detecting that the PMU firmware is loaded
authorSiva Durga Prasad Paladugu <[email protected]>
Mon, 30 Apr 2018 14:09:49 +0000 (19:39 +0530)
committerSiva Durga Prasad Paladugu <[email protected]>
Thu, 17 May 2018 09:48:42 +0000 (15:18 +0530)
Use positive logic (pm_up instead of pm_down) to check whether PMU
services are available. This change also puts the variable into the
BSS section rather than the Data section as the variable is now
initialized to 0 rather than 1.

Signed-off-by: Will Wong <[email protected]>
Signed-off-by: Stefan Krsmanovic <[email protected]>
Signed-off-by: Siva Durga Prasad Paladugu <[email protected]>
plat/xilinx/zynqmp/pm_service/pm_svc_main.c

index 84bd887a283fa5adf9a367cf281ff603762a2b57..bca2c409750424ea92c6db46fcd9bed1cca1753f 100644 (file)
@@ -22,8 +22,8 @@
 #define PM_SET_SUSPEND_MODE    0xa02
 #define PM_GET_TRUSTZONE_VERSION       0xa03
 
-/* 0 - UP, !0 - DOWN */
-static int32_t pm_down = !0;
+/* !0 - UP, 0 - DOWN */
+static int32_t pm_up = 0;
 
 /**
  * pm_context - Structure which contains data for power management
@@ -67,7 +67,7 @@ int pm_setup(void)
                ret = status;
        }
 
-       pm_down = status;
+       pm_up = !status;
 
        return ret;
 }
@@ -96,7 +96,7 @@ uint64_t pm_smc_handler(uint32_t smc_fid, uint64_t x1, uint64_t x2, uint64_t x3,
        uint32_t pm_arg[4];
 
        /* Handle case where PM wasn't initialized properly */
-       if (pm_down)
+       if (!pm_up)
                SMC_RET1(handle, SMC_UNK);
 
        pm_arg[0] = (uint32_t)x1;